package com.wzh.yebServe.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Author wzh
 * @create 2022/11/19 16:36
 * @Description: mybatisPlus分页配置
 * 分页插件的原理：
 * 在做查询操作时还是正常的写sql语句，他会自动的拦截你的sql语句为你添加分页语句
 */
@Configuration
@EnableTransactionManagement//事务
@MapperScan("com.wzh.yebServe.mapper")
public class MybatisPlusConfig {



    //分页插件
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor=new MybatisPlusInterceptor ();
        interceptor.addInnerInterceptor (new PaginationInnerInterceptor ());
        return interceptor;
    }


}
